import { UserLayout, BasicLayout, PublicReportLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/workplace',
    children: [
      {
        path: '/workplace',
        name: 'Workplace',
        // hidden: true,
        component: () => import('@/views/home/Workplace'),
        meta: { title: '个人首页',  keepAlive: true, icon: 'home' },
      },
      {
        path: '/operationPlanManage/add',
        name: 'OperationPlanManageAdd',
        hidden: true,
        component: () => import('@/views/operationPlanManage/addAndUpdatePlan'),
        meta: { title: '运营计划管理', keepAlive: true, icon: 'fund' },
      },
      {
        path: '/operationPlanManage/edit',
        name: 'OperationPlanManageEdit',
        hidden: true,
        component: () => import('@/views/operationPlanManage/addAndUpdatePlan'),
        meta: { title: '运营计划管理', keepAlive: true, icon: 'fund' },
      },
      {
        path: '/operationPlanManage/view',
        name: 'OperationPlanManageView',
        hidden: true,
        component: () => import('@/views/operationPlanManage/viewPlan'),
        meta: { title: '运营计划管理', keepAlive: true, icon: 'fund' },
      },
      {
        path: '/operationPlanManage/audit',
        name: 'OperationPlanManageAudit',
        hidden: true,
        component: () => import('@/views/operationPlanManage/auditPlan'),
        meta: { title: '运营计划管理', keepAlive: true, icon: 'fund', permission: ['push.audit']  },
      },
      {
        path: '/operationPlanManage',
        name: 'OperationPlanManage',
        // hidden: true,
        component: () => import('@/views/operationPlanManage/planList'),
        meta: { title: '运营计划管理', keepAlive: true, icon: 'fund'},
      },
      // {
      //   path: '/userProfile',
      //   name: 'UserProfile',
      //   component: RouteView,
      //   meta: {
      //     title: '用户分群',
      //     keepAlive: true,
      //     icon: 'team',
      //     permission: ['userProfile', 'userProfile.userGroup.view', 'userProfile.userTag.view']
      //   },
      //   children: [
      //     {
      //       path: '/userProfile/userTag/list',
      //       name: 'UserTagList',
      //       component: () => import('@/views/userProfile/userTag/TagList'),
      //       meta: { title: '用户标签管理', keepAlive: true, permission: ['userProfile', 'userProfile.userTag.view']}
      //     },
      //     {
      //       path: '/userProfile/userTag/detail',
      //       name: 'UserTagDetail',
      //       component: () => import('@/views/userProfile/userTag/UserTagDetail'),
      //       hidden: true,
      //       meta: { title: '用户标签详情', keepAlive: true, permission: ['userProfile', 'userProfile.userTag.view'] }
      //     },
      //     {
      //       path: '/userProfile/userGroup/list',
      //       name: 'UserGroupList',
      //       component: () => import('@/views/userProfile/userGroup/GroupList'),
      //       meta: { title: '用户分群管理', keepAlive: true, permission: ['userProfile', 'userProfile.userGroup.view'] }
      //     },
      //     {
      //       path: '/userProfile/userDetail/list',
      //       name: 'UserDetailList',
      //       component: () => import('@/views/userProfile/userDetail/UserList'),
      //       meta: { title: '用户列表', keepAlive: true, permission: ['userProfile', 'userProfile.userGroup.view'] }
      //     },
      //     {
      //       path: '/userProfile/userDetail/detail',
      //       name: 'UserDetail',
      //       component: () => import('@/views/userProfile/userDetail/UserDetail'),
      //       hidden: true,
      //       meta: { title: '用户详情', keepAlive: true, permission: ['userProfile', 'userProfile.userGroup.view'] }
      //     },
      //   ]
      // },
      {
        path: '/system',
        name: 'System',
        component: RouteView,
        redirect: '/system/in_data',
        meta: { title: '系统管理',  keepAlive: true, icon: 'setting' },
        children: [
          {
            path: '/system/in_data',
            name: 'InData',
            component: () => import('@/views/dataConfig/inData'),
            meta: { title: '数据源管理', keepAlive: true, permission: ['datasource', 'datasource.view'] }
          },
          {
            path: '/system/menu',
            name: 'DefaultUser',
            component: () => import('@/views/menu/menuList'),
            meta: { title: '菜单管理', keepAlive: true, permission: ['menu', 'menu.view'] }
          },
          {
            path: '/system/user',
            name: 'UserList',
            component: () => import('@/views/user/userList'),
            meta: { title: '用户管理', keepAlive: true, permission: ['push.user', 'push.user.view'] }
          },
          {
            path: '/system/role',
            name: 'RoleList',
            component: () => import('@/views/role/roleList'),
            meta: { title: '角色管理', keepAlive: true, permission: ['push.role', 'push.role.view'] }
          },
          {
            path: '/system/org',
            name: 'OrganizationList',
            component: () => import('@/views/org/orgList'),
            meta: { title: '组织机构管理', keepAlive: true, permission: ['push.organization', 'push.organization.view'] }
          },
          {
            path: '/system/announcement',
            name: 'AnnouncementManage',
            component: () => import('@/views/systemManage/announcementManage/announcementList'),
            meta: { title: '公告管理', keepAlive: true }
          },
          {
            path: '/system/auditLog',
            name: 'AuditLog',
            component: () => import('@/views/systemManage/audit/auditLog'),
            meta: { title: '审计日志', keepAlive: true, permission: ['accessLogs']}
          },
          {
            path: '/profile',
            component: RouteView,
            hidden: true,
            redirect: '/profile/center',
            name: 'MyProfile',
            // meta: { title: '个人设置', keepAlive: true },
            children: [
              {
                path: 'center',
                name: 'Center',
                component: () => import('@/views/myProfile/Index'),
                meta: { title: '个人中心', keepAlive: true }
              },
              {
                path: 'info',
                name: 'MyInfo',
                component: () => import('@/views/myProfile/myInfo'),
                meta: { title: '个人信息', keepAlive: true }
              },
              {
                path: 'personal',
                name: 'Personal',
                component: () => import('@/views/myProfile/personal'),
                meta: { title: '个人爱好', keepAlive: true }
              },
              {
                path: 'set_password',
                name: 'SetPassword',
                component: () => import('@/views/myProfile/setPassword'),
                meta: { title: '修改密码', keepAlive: true }
              }
            ]
          },
          // {
          //   path: '/system/report',
          //   name: 'ReportList',
          //   component: () => import('@/views/reportForms/reportList'),
          //   meta: { title: '自定义报表', keepAlive: true, permission: ['report', 'report.view'] }
          // },
          // {
          //   path: '/system/show_reports/:id',
          //   name: 'ShowReports',
          //   hidden: true,
          //   component: () => import('@/views/reportForms/showReports'),
          //   meta: { title: '报表展示', keepAlive: true }
          // },
          // {
          //   path: '/system/report_config',
          //   name: 'ReportConfig',
          //   hidden: true,
          //   component: () => import('@/views/reportForms/reportConfig'),
          //   meta: { title: '报表配置', keepAlive: true },
          //   children: [
          //     {
          //       path: 'ds',
          //       name: 'Ds',
          //       component: () => import('@/views/reportForms/reportConfig/ds'),
          //       meta: { title:'数据集' },
          //     },
          //     {
          //       path: 'filter',
          //       name: 'Filter',
          //       component: () => import('@/views/reportForms/reportConfig/filter'),
          //       meta: { title:'筛选区' },
          //     },
          //     {
          //       path: 'echarts',
          //       name: 'Echarts',
          //       component: () => import('@/views/reportForms/reportConfig/echarts'),
          //       meta: { title:'图表' },
          //     },
          //   ]
          // }
        ]
      },
    ]
  },
  // {
  //   path: '*',
  //   redirect: '/404',
  //   hidden: true
  // }
]
import helpDocument from '@/views/help/HelpDcoument.vue'
import publicReports from "@/views/reportForms/publicReports";

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/login',
    component: UserLayout,
    redirect: '/login/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import('@/views/login/Login')
      }
    ]
  },
  {
    path: '/helpDcoumentPage',
    component: helpDocument,
    hidden: true,
    meta: { title: '帮助文档', keepAlive: true, permission: ['document', 'document.view'] }
  },
  {
    path: '/404',
    component: () => import('@/views/exception/404')
  },
  {
    path: '/public',
    name: 'public',
    component: PublicReportLayout,
    redirect: '/public/report/',
    children: [
      {
        path: '/public/report/:id',
        name: 'publicReport',
        hidden: true,
        component: publicReports,
        meta: { title: '公共报表展示', keepAlive: true }
      },
    ]
  }
]
